﻿using System.Data;
using ET;
using System.Data.SqlClient;
namespace DAL
{
    public class Proposed_DAL : clsConnect
    {
        private static readonly clsConnect cls = new clsConnect();
        #region[Get-Data]
        public DataTable GetDataProposed(string keywords)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@KEYWORDS", keywords);
            return cls.GetData("sp_tb_Proposed_Get");
        }
        public DataTable GetDataProposedNew()
        {
            cls.CreateNewSqlCommand();
            return cls.GetData("sp_tb_Proposed_Get_New");
        }
        public DataTable GetDataProposedEdit(int id)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@Proposed_ID", id);
            return cls.GetData("sp_tb_Proposed_Edit");
        }
        public DataTable GetDataProposedGridEdit(int id)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@Proposed_ID", id);
            return cls.GetData("sp_tb_Proposed_Grid_Edit");
        }
        public DataTable GetOrderBuyCode()
        {
            cls.CreateNewSqlCommand();
            return cls.GetData("sp_tb_Order_Buy_Get_Code");
        }
        public DataTable GetMaterialOrderBuyCode(int id)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@Order_Buy_Id", id);
            return cls.GetData("sp_tb_Order_Buy_Get_Material_Code");
        }
        public static DataTable GetDataProposedFillterActive(int id)
        {
           cls.CreateNewSqlCommand();
           cls.AddParameter("@IsActive", id);
           return cls.GetData("sp_tb_Proposed_FillterActive");
        }
        public static DataTable GetDataProposedFillterDate(string DateBegin,string DateEnd)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@DateBegin", DateBegin);
            cls.AddParameter("@EndBegin", DateEnd);
            return cls.GetData("sp_tb_Proposed_FillterDate");
        }
        #endregion

        #region[Insert-Update-Delete]
        public bool InsertProposed(Proposed_ET data)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@Proposed_TaxCode", data.Proposed_TaxCode);
            cls.AddParameter("@Proposed_DateBegin", data.Proposed_DateBegin);
            cls.AddParameter("@Users_Id", data.Users_Id);
            cls.AddParameter("@Proposed_Descripttion", data.Proposed_Descripttion);
            return cls.ExecuteNonQuery("sp_tb_Proposed_Insert");
        }
        public bool UpdateProposed(Proposed_ET data)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@Proposed_ID", data.Proposed_ID);
            cls.AddParameter("@Proposed_TaxCode_", data.Proposed_TaxCode_);
            cls.AddParameter("@Proposed_Descripttion", data.Proposed_Descripttion);
            return cls.ExecuteNonQuery("sp_tb_Proposed_Update");
        }
        public bool DeleteProposed(int id)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@Proposed_ID", id);
            return cls.ExecuteNonQuery("sp_tb_Proposed_Delete"); ;
        }
        #endregion

        #region[Review]
        public bool ReviewProposed(Proposed_ET data)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@Proposed_ID", data.Proposed_ID);
            cls.AddParameter("@IsActive", data.IsActive);
            cls.AddParameter("@Users_Id_Respone", data.Users_Id_Respone);
            cls.AddParameter("@Proposed_DateRespone", data.Proposed_DateRespone);
            return cls.ExecuteNonQuery("sp_tb_Proposed_Review");
        }
        #endregion
    }
}
